<?php
define('FPDF_FONTPATH','font/');
require('../fpdf/fpdf.php');
include ("../Model/ModelConexion.php");

class PDF extends FPDF
{
//Page header
function Header()
{
    //Logo
    $this->Image('Una.png',10,8,25);
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(40);
    //Title
  

    $this->Cell(30,30, 'Carreras del Sistema',0,1,'C');
    //Line break
 
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    
    $this->SetY(-10);
    //Arial italic 8
    $this->SetFont('Arial','I',10);
    //Page number
    
    $fechayHora = date("d-m-Y");

    $hora=time();
    $this->Cell(275,-5,'Sistema GesAc',0,1,'C');
    $this->Cell(0,-6,'El dia '.$fechayHora,0,1,'C');
    $this->Cell(0,-6, 'Impreso en '.'Nicoya,Guanacaste,Costa Rica',0,1,'C');

}
}
//Instanciation of inherited class

$pdf = new PDF('P','mm','Letter');
$pdf->SetMargins(52,0);

$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);

$pdf->Cell(23,5,"Codigo",1,0,'C');
$pdf->Cell(90,5,"Nombre",1,1,'C');

        
    //Datos de Conexion


      $objeto = new Conexion(); 
     $rec = $objeto->Consulta("
      SELECT * FROM carreras
        ");

      while ($row = mysql_fetch_array($rec)) {
        $pdf->Cell(23,5,$row['codigo'],1,0,'C');
        $pdf->Cell(90,5,$row['nombre'],1,1,'C');

      }

$pdf->Output();
?>